package com.shuaibiao.controller.base;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.shuaibiao.entity.base.Constants;
import com.shuaibiao.entity.base.JsonResult;

@RestController
@RequestMapping("/base")
public class LoginController {

	@RequestMapping("/login")
	public JsonResult login(HttpServletRequest request,String username,String password,String vercode,String remember){
		//从Session中获取生成的验证码
		String validatecode = (String) request.getSession().getAttribute("captcha");
		//校验验证码是否输入正确
		if(StringUtils.isNotBlank(vercode) && vercode.equals(validatecode)){
			return new JsonResult(Constants.OK,"登入成功");
			
		}else{
			return new JsonResult(Constants.ERROR,"验证码输入错误");
		}
	}
}
